<form id="frmPost" name="frmPost" method="POST" enctype="multipart/form-data">
    <table class="detail_info">
        <tbody>
            <tr>
                <td class="column_left">
                    Comment ID
                </td>
                <td class="column_right">
                    <input type="text" name="comment_id" id="comment_id" readonly="true" value="<?php echo $this->arrComment['comment_id']; ?>" size="25" tabindex="1" />
                </td>
            </tr>
            <tr>
                <td class="column_left">
                    Team ID
                </td>
                <td class="column_right">
                    <input type="text" name="team_id" id="team_id" readonly="true" value="<?php echo $this->arrComment['team_id']; ?>" size="25" tabindex="2" />
                </td>
            </tr>
            <tr>
                <td class="column_left">
                    Match ID
                </td>
                <td class="column_right">
                    <input type="text" name="match_id" id="match_id" readonly="true" value="<?php echo $this->arrComment['match_id']; ?>" size="25" tabindex="3" />
                </td>
            </tr>
            <tr>
                <td class="column_left">
                     Nội dung comment<span style="color: red;">*</span>   
                </td>
                <td class="column_right" style="width: auto!important;">
                    <textarea cols="70" rows="2" name="content" id="content" tabindex="4"><?php echo $this->arrComment['content']; ?></textarea>
                    <span id="content_err" style="display: none; color: red; float: left"></span>
                </td>
            </tr>
            <tr>
                <td class="column_left">
                    Cho phép hiện comment
                </td>
                <td class="column_right">
                    <input type="checkbox" name="is_approve" id="is_approve" <?php if( $this->arrComment['is_approve'] == 1){echo 'checked';} ?> value="<?php echo $this->arrComment['is_approve']; ?>" size="25" tabindex="5" />
                </td>
            </tr>
        </tbody>
    </table>
    <div class="btn_back">
        <input type="submit" name="submit" id="submit" value="Đồng ý" tabindex="6" />
        <input type="button" name="cancel" value="Bỏ qua" onclick="window.location='<?php echo BASE_URL_CLUB;?>/subpage/listcomment';" tabindex="7" />
    </div>
</form>
<script type="text/javascript">
    
    var commentSubpge = { 
        strip_tags:function(input, allowed) {
            allowed = (((allowed || "") + "")
                .toLowerCase()
                .match(/<[a-z][a-z0-9]*>/g) || [])
            .join('');
            var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
            commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, function($0, $1){
                return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
            });
        },
        initFormUpdateComment:function() {
            $("#frmPost").submit(function() {
                var title = $("#content").val(); 
                if($.trim(title).length <= 0){ 
                        $("#content_err").html('Nội dung comment không được để trống.<br>').show();
                        error   = 1;
                }else{ 
                        $("#content_err").text('').hide(); 
                }
                if($('#is_approve').is(':checked')){ 
                    $('#is_approve').val('1');
                }else{
                    $('#is_approve').val('0');
                }
                return !error;
            });
        },
        post:function() {
            $("#frmPost").attr('action', domain_url+'/subpage/updatecomment');
        }
    }

    $(function(){
        commentSubpge.initFormUpdateComment();
    });

</script>
